package com.xinfu.newproject.adapter.meter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xinfu.newproject.R;
import com.xinfu.newproject.bean.meter.bean.MeterListBean;

/**
 * 文 件 名: WaterRefillPullToRefreshAdapter
 * 创 建 人: Allen
 * 创建日期: 16/12/24 19:55
 * 邮   箱: AllenCoder@126.com
 * 修改时间：
 * 修改备注：
 */
public class WaterRefillPullToRefreshAdapter extends BaseQuickAdapter<MeterListBean.ResultBean, BaseViewHolder> {

    Integer position;
    String amount;

    public WaterRefillPullToRefreshAdapter() {
        super(R.layout.item_water_refill, null);
    }

    public void addAmount(Integer position, String amount) {
        this.position = position;
        this.amount = amount;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, MeterListBean.ResultBean item) {
        helper.setText(R.id.item_water_refill_ammeter_num, item.getPayMeterNo());
        helper.setText(R.id.item_water_refill_tv_name, item.getPayMeterNo());
        helper.setText(R.id.item_water_refill_tv_address, item.getAddress());
        helper.setText(R.id.item_water_refill_ammeter_tv_dump_energy, item.getRemainUse() + "");
        helper.setText(R.id.item_water_refill_tv_total_usage, item.getTotalUse() + "");
        helper.addOnClickListener(R.id.item_water_refill_tv_amount);
        helper.addOnClickListener(R.id.item_water_refill_tv_recharge);
        if (position != null && position == helper.getPosition()) {
            helper.setText(R.id.item_water_refill_tv_amount, amount);
        }

    }



}
